<?php
/**
 * Created by PhpStorm.
 * User: huang
 * Date: 2018/9/18 0018
 * Time: 16:54
 */

namespace app\store\model;
use app\common\model\PromotionFullMail as PromotionFullMailModel;

/**
 * 满额包邮
 * Class PromotionFullMail
 * @package app\store\model
 */
class PromotionFullMail extends PromotionFullMailModel
{
    protected $autoWriteTimestamp = true;
    protected $pk = 'mail_id';

    /**
     * 设置满额包邮
     * @param $data
     * @return bool
     */
    public function edit($data)
    {
        $model = new static();
        $data['wxapp_id'] = self::$wxapp_id;
        $where = [];
        if(!empty($data['mail_id'])){
            $where['mail_id'] = $data['mail_id'];
        }
        $res = $model->allowField(true)->save($data,$where);
        return $res !== false ?: false;
    }
}